﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YJKArchUtils.Utils;
using YJKRevitBase.WinForm;
using YJKRevitView;
using YJKInspectModel.LongitudinalModel;

namespace YJKInspectModel.ModelValidation.Commands
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class CmdLongitudinalModelChecking : IExternalCommand
	{
		public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elems)
		{
			FloorSelectManager.CommandName = "CmdLongitudinalModelChecking";
			CmdViewType types = (CmdViewType)123;
			if (SwitchView.SetUsableView(types, cmdData) != Autodesk.Revit.UI.Result.Succeeded)
			{
				return Autodesk.Revit.UI.Result.Failed;
			}
			if (CmdLongitudinalModelChecking._hWndRevit == null)
			{
				CmdLongitudinalModelChecking._hWndRevit = new WindowHandle(Process.GetCurrentProcess().MainWindowHandle);
			}
			HideWarningAndErroringKit @object = new HideWarningAndErroringKit(new List<string>
			{
				"join elemet"
			}, HideWarningAndErroringKit.HideKitEnum.HideErroring);
			cmdData.Application.Application.FailuresProcessing += @object.OnFailuresProcessing;
			return new LongitudinalModelCheckingController(cmdData).Checking(ref msg);
		}

		public static WindowHandle _hWndRevit;
	}
}
